package com.fhz.shop.di;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;

/**
 * 时间:2023/8/19
 *
 * @author Mr.Feng
 * 简述: 线程池
 */
@Module
@InstallIn(SingletonComponent.class)
public class MyExecutorService {

    @Provides
    @Singleton
    public ExecutorService getExecutorService(){
        return new ThreadPoolExecutor(4, 10,
                1L, TimeUnit.MINUTES,
                new SynchronousQueue<Runnable>());
    }

}   
